<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Title</title>
  </head>
  <body>
    <canvas id="canvas" width="400" height="400">此浏览器不支持canvas</canvas>
  </body>
</html>
<script>
  /** @type {HTMLCanvasElement} */
  const canvas = document.getElementById("canvas");
  const gl = canvas.getContext("webgl");
  gl.clearColor(1.0, 0.0, 0.0, 1.0); // 指定清空canvas的颜色，接收4个参数 rgba(取值区间为0 ~ 1.0)
  gl.clear(gl.COLOR_BUFFER_BIT); // COLOR_BUFFER_BIT - 清空颜色缓存  DEPTH_BUFFER_BIT - 清空深度缓冲区 STENCIL_BUFFER_BIT - 清空模版缓冲区
</script>
